<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "psacar_carinfo.php" ?>
<?php include "psacar_userinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$psacar_car_view = new cpsacar_car_view();
$Page =& $psacar_car_view;

// Page init
$psacar_car_view->Page_Init();

// Page main
$psacar_car_view->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($psacar_car->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var psacar_car_view = new ew_Page("psacar_car_view");

// page properties
psacar_car_view.PageID = "view"; // page ID
psacar_car_view.FormID = "fpsacar_carview"; // form ID
var EW_PAGE_ID = psacar_car_view.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
psacar_car_view.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
psacar_car_view.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
psacar_car_view.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<p><span class="phpmaker"><?php echo $Language->Phrase("View") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $psacar_car->TableCaption() ?>
<?php if ($psacar_car->Export == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $psacar_car_view->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
&nbsp;&nbsp;<a href="<?php echo $psacar_car_view->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
<br><br>
<?php if ($psacar_car->Export == "") { ?>
<a href="<?php echo $psacar_car_view->ListUrl ?>"><?php echo $Language->Phrase("BackToList") ?></a>&nbsp;
<?php if ($Security->IsLoggedIn()) { ?>
<a href="<?php echo $psacar_car_view->AddUrl ?>"><?php echo $Language->Phrase("ViewPageAddLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<a href="<?php echo $psacar_car_view->EditUrl ?>"><?php echo $Language->Phrase("ViewPageEditLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<a href="<?php echo $psacar_car_view->CopyUrl ?>"><?php echo $Language->Phrase("ViewPageCopyLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<a href="<?php echo $psacar_car_view->DeleteUrl ?>"><?php echo $Language->Phrase("ViewPageDeleteLink") ?></a>&nbsp;
<?php } ?>
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$psacar_car_view->ShowMessage();
?>
<p>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($psacar_car->id->Visible) { // id ?>
	<tr<?php echo $psacar_car->id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->id->FldCaption() ?></td>
		<td<?php echo $psacar_car->id->CellAttributes() ?>>
<div<?php echo $psacar_car->id->ViewAttributes() ?>><?php echo $psacar_car->id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->dealer_id->Visible) { // dealer_id ?>
	<tr<?php echo $psacar_car->dealer_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->dealer_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->dealer_id->CellAttributes() ?>>
<div<?php echo $psacar_car->dealer_id->ViewAttributes() ?>><?php echo $psacar_car->dealer_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->series_id->Visible) { // series_id ?>
	<tr<?php echo $psacar_car->series_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->series_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->series_id->CellAttributes() ?>>
<div<?php echo $psacar_car->series_id->ViewAttributes() ?>><?php echo $psacar_car->series_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->external_color_id->Visible) { // external_color_id ?>
	<tr<?php echo $psacar_car->external_color_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->external_color_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->external_color_id->CellAttributes() ?>>
<div<?php echo $psacar_car->external_color_id->ViewAttributes() ?>><?php echo $psacar_car->external_color_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->type_id->Visible) { // type_id ?>
	<tr<?php echo $psacar_car->type_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->type_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->type_id->CellAttributes() ?>>
<div<?php echo $psacar_car->type_id->ViewAttributes() ?>><?php echo $psacar_car->type_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->category_id->Visible) { // category_id ?>
	<tr<?php echo $psacar_car->category_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->category_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->category_id->CellAttributes() ?>>
<div<?php echo $psacar_car->category_id->ViewAttributes() ?>><?php echo $psacar_car->category_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->description->Visible) { // description ?>
	<tr<?php echo $psacar_car->description->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->description->FldCaption() ?></td>
		<td<?php echo $psacar_car->description->CellAttributes() ?>>
<div<?php echo $psacar_car->description->ViewAttributes() ?>><?php echo $psacar_car->description->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->price->Visible) { // price ?>
	<tr<?php echo $psacar_car->price->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->price->FldCaption() ?></td>
		<td<?php echo $psacar_car->price->CellAttributes() ?>>
<div<?php echo $psacar_car->price->ViewAttributes() ?>><?php echo $psacar_car->price->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->quality->Visible) { // quality ?>
	<tr<?php echo $psacar_car->quality->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->quality->FldCaption() ?></td>
		<td<?php echo $psacar_car->quality->CellAttributes() ?>>
<div<?php echo $psacar_car->quality->ViewAttributes() ?>><?php echo $psacar_car->quality->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->post_by->Visible) { // post_by ?>
	<tr<?php echo $psacar_car->post_by->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->post_by->FldCaption() ?></td>
		<td<?php echo $psacar_car->post_by->CellAttributes() ?>>
<div<?php echo $psacar_car->post_by->ViewAttributes() ?>><?php echo $psacar_car->post_by->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->post_date->Visible) { // post_date ?>
	<tr<?php echo $psacar_car->post_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->post_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->post_date->CellAttributes() ?>>
<div<?php echo $psacar_car->post_date->ViewAttributes() ?>><?php echo $psacar_car->post_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->expiration_date->Visible) { // expiration_date ?>
	<tr<?php echo $psacar_car->expiration_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->expiration_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->expiration_date->CellAttributes() ?>>
<div<?php echo $psacar_car->expiration_date->ViewAttributes() ?>><?php echo $psacar_car->expiration_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->number_votes->Visible) { // number_votes ?>
	<tr<?php echo $psacar_car->number_votes->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->number_votes->FldCaption() ?></td>
		<td<?php echo $psacar_car->number_votes->CellAttributes() ?>>
<div<?php echo $psacar_car->number_votes->ViewAttributes() ?>><?php echo $psacar_car->number_votes->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->total_points->Visible) { // total_points ?>
	<tr<?php echo $psacar_car->total_points->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->total_points->FldCaption() ?></td>
		<td<?php echo $psacar_car->total_points->CellAttributes() ?>>
<div<?php echo $psacar_car->total_points->ViewAttributes() ?>><?php echo $psacar_car->total_points->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->dec_avg->Visible) { // dec_avg ?>
	<tr<?php echo $psacar_car->dec_avg->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->dec_avg->FldCaption() ?></td>
		<td<?php echo $psacar_car->dec_avg->CellAttributes() ?>>
<div<?php echo $psacar_car->dec_avg->ViewAttributes() ?>><?php echo $psacar_car->dec_avg->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->whole_avg->Visible) { // whole_avg ?>
	<tr<?php echo $psacar_car->whole_avg->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->whole_avg->FldCaption() ?></td>
		<td<?php echo $psacar_car->whole_avg->CellAttributes() ?>>
<div<?php echo $psacar_car->whole_avg->ViewAttributes() ?>><?php echo $psacar_car->whole_avg->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->internal_color_id->Visible) { // internal_color_id ?>
	<tr<?php echo $psacar_car->internal_color_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->internal_color_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->internal_color_id->CellAttributes() ?>>
<div<?php echo $psacar_car->internal_color_id->ViewAttributes() ?>><?php echo $psacar_car->internal_color_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->transmission->Visible) { // transmission ?>
	<tr<?php echo $psacar_car->transmission->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->transmission->FldCaption() ?></td>
		<td<?php echo $psacar_car->transmission->CellAttributes() ?>>
<div<?php echo $psacar_car->transmission->ViewAttributes() ?>><?php echo $psacar_car->transmission->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->legal->Visible) { // legal ?>
	<tr<?php echo $psacar_car->legal->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->legal->FldCaption() ?></td>
		<td<?php echo $psacar_car->legal->CellAttributes() ?>>
<div<?php echo $psacar_car->legal->ViewAttributes() ?>><?php echo $psacar_car->legal->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->import_tax->Visible) { // import_tax ?>
	<tr<?php echo $psacar_car->import_tax->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->import_tax->FldCaption() ?></td>
		<td<?php echo $psacar_car->import_tax->CellAttributes() ?>>
<div<?php echo $psacar_car->import_tax->ViewAttributes() ?>><?php echo $psacar_car->import_tax->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->drive_train->Visible) { // drive_train ?>
	<tr<?php echo $psacar_car->drive_train->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->drive_train->FldCaption() ?></td>
		<td<?php echo $psacar_car->drive_train->CellAttributes() ?>>
<div<?php echo $psacar_car->drive_train->ViewAttributes() ?>><?php echo $psacar_car->drive_train->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->door_count->Visible) { // door_count ?>
	<tr<?php echo $psacar_car->door_count->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->door_count->FldCaption() ?></td>
		<td<?php echo $psacar_car->door_count->CellAttributes() ?>>
<div<?php echo $psacar_car->door_count->ViewAttributes() ?>><?php echo $psacar_car->door_count->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->fuel->Visible) { // fuel ?>
	<tr<?php echo $psacar_car->fuel->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->fuel->FldCaption() ?></td>
		<td<?php echo $psacar_car->fuel->CellAttributes() ?>>
<div<?php echo $psacar_car->fuel->ViewAttributes() ?>><?php echo $psacar_car->fuel->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->vat->Visible) { // vat ?>
	<tr<?php echo $psacar_car->vat->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->vat->FldCaption() ?></td>
		<td<?php echo $psacar_car->vat->CellAttributes() ?>>
<div<?php echo $psacar_car->vat->ViewAttributes() ?>><?php echo $psacar_car->vat->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->destinations->Visible) { // destinations ?>
	<tr<?php echo $psacar_car->destinations->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->destinations->FldCaption() ?></td>
		<td<?php echo $psacar_car->destinations->CellAttributes() ?>>
<div<?php echo $psacar_car->destinations->ViewAttributes() ?>><?php echo $psacar_car->destinations->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->rent_type->Visible) { // rent_type ?>
	<tr<?php echo $psacar_car->rent_type->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->rent_type->FldCaption() ?></td>
		<td<?php echo $psacar_car->rent_type->CellAttributes() ?>>
<div<?php echo $psacar_car->rent_type->ViewAttributes() ?>><?php echo $psacar_car->rent_type->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->vehicle_type_id->Visible) { // vehicle_type_id ?>
	<tr<?php echo $psacar_car->vehicle_type_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->vehicle_type_id->FldCaption() ?></td>
		<td<?php echo $psacar_car->vehicle_type_id->CellAttributes() ?>>
<div<?php echo $psacar_car->vehicle_type_id->ViewAttributes() ?>><?php echo $psacar_car->vehicle_type_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->is_driver->Visible) { // is_driver ?>
	<tr<?php echo $psacar_car->is_driver->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->is_driver->FldCaption() ?></td>
		<td<?php echo $psacar_car->is_driver->CellAttributes() ?>>
<div<?php echo $psacar_car->is_driver->ViewAttributes() ?>><?php echo $psacar_car->is_driver->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->image->Visible) { // image ?>
	<tr<?php echo $psacar_car->image->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->image->FldCaption() ?></td>
		<td<?php echo $psacar_car->image->CellAttributes() ?>>
<?php if ($psacar_car->image->HrefValue <> "" || $psacar_car->image->TooltipValue <> "") { ?>
<?php if (!empty($psacar_car->image->Upload->DbValue)) { ?>
<a href="<?php echo $psacar_car->image->HrefValue ?>"><?php echo $psacar_car->image->ViewValue ?></a>
<?php } elseif (!in_array($psacar_car->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($psacar_car->image->Upload->DbValue)) { ?>
<?php echo $psacar_car->image->ViewValue ?>
<?php } elseif (!in_array($psacar_car->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</td>
	</tr>
<?php } ?>
<?php if ($psacar_car->vehicle_id_number->Visible) { // vehicle_id_number ?>
	<tr<?php echo $psacar_car->vehicle_id_number->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->vehicle_id_number->FldCaption() ?></td>
		<td<?php echo $psacar_car->vehicle_id_number->CellAttributes() ?>>
<div<?php echo $psacar_car->vehicle_id_number->ViewAttributes() ?>><?php echo $psacar_car->vehicle_id_number->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->negotiate->Visible) { // negotiate ?>
	<tr<?php echo $psacar_car->negotiate->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->negotiate->FldCaption() ?></td>
		<td<?php echo $psacar_car->negotiate->CellAttributes() ?>>
<div<?php echo $psacar_car->negotiate->ViewAttributes() ?>><?php echo $psacar_car->negotiate->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->duration->Visible) { // duration ?>
	<tr<?php echo $psacar_car->duration->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->duration->FldCaption() ?></td>
		<td<?php echo $psacar_car->duration->CellAttributes() ?>>
<div<?php echo $psacar_car->duration->ViewAttributes() ?>><?php echo $psacar_car->duration->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->create_date->Visible) { // create_date ?>
	<tr<?php echo $psacar_car->create_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->create_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->create_date->CellAttributes() ?>>
<div<?php echo $psacar_car->create_date->ViewAttributes() ?>><?php echo $psacar_car->create_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->end_date->Visible) { // end_date ?>
	<tr<?php echo $psacar_car->end_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->end_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->end_date->CellAttributes() ?>>
<div<?php echo $psacar_car->end_date->ViewAttributes() ?>><?php echo $psacar_car->end_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->status->Visible) { // status ?>
	<tr<?php echo $psacar_car->status->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->status->FldCaption() ?></td>
		<td<?php echo $psacar_car->status->CellAttributes() ?>>
<div<?php echo $psacar_car->status->ViewAttributes() ?>><?php echo $psacar_car->status->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->code->Visible) { // code ?>
	<tr<?php echo $psacar_car->code->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->code->FldCaption() ?></td>
		<td<?php echo $psacar_car->code->CellAttributes() ?>>
<div<?php echo $psacar_car->code->ViewAttributes() ?>><?php echo $psacar_car->code->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->created_date->Visible) { // created_date ?>
	<tr<?php echo $psacar_car->created_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->created_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->created_date->CellAttributes() ?>>
<div<?php echo $psacar_car->created_date->ViewAttributes() ?>><?php echo $psacar_car->created_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($psacar_car->modified_date->Visible) { // modified_date ?>
	<tr<?php echo $psacar_car->modified_date->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $psacar_car->modified_date->FldCaption() ?></td>
		<td<?php echo $psacar_car->modified_date->CellAttributes() ?>>
<div<?php echo $psacar_car->modified_date->ViewAttributes() ?>><?php echo $psacar_car->modified_date->ViewValue ?></div></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<?php if ($psacar_car->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$psacar_car_view->Page_Terminate();
?>
<?php

//
// Page class
//
class cpsacar_car_view {

	// Page ID
	var $PageID = 'view';

	// Table name
	var $TableName = 'psacar_car';

	// Page object name
	var $PageObjName = 'psacar_car_view';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $psacar_car;
		if ($psacar_car->UseTokenInUrl) $PageUrl .= "t=" . $psacar_car->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $psacar_car;
		if ($psacar_car->UseTokenInUrl) {
			if ($objForm)
				return ($psacar_car->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($psacar_car->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function cpsacar_car_view() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (psacar_car)
		$GLOBALS["psacar_car"] = new cpsacar_car();

		// Table object (psacar_user)
		$GLOBALS['psacar_user'] = new cpsacar_user();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'view', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'psacar_car', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $psacar_car;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$psacar_car->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$psacar_car->Export = $_POST["exporttype"];
		} else {
			$psacar_car->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $psacar_car->Export; // Get export parameter, used in header
		$gsExportFile = $psacar_car->TableVar; // Get export file, used in header
		if (@$_GET["id"] <> "") {
			if ($gsExportFile <> "") $gsExportFile .= "_";
			$gsExportFile .= ew_StripSlashes($_GET["id"]);
		}
		if (in_array($psacar_car->Export, array("html", "email", "excel", "word")))
			echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
		if ($psacar_car->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel;charset=utf-8');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $lDisplayRecs = 1;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $lRecCnt;
	var $arRecKey = array();

	//
	// Page main
	//
	function Page_Main() {
		global $Language, $psacar_car;

		// Load current record
		$bLoadCurrentRecord = FALSE;
		$sReturnUrl = "";
		$bMatchRecord = FALSE;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET["id"] <> "") {
				$psacar_car->id->setQueryStringValue($_GET["id"]);
				$this->arRecKey["id"] = $psacar_car->id->QueryStringValue;
			} else {
				$sReturnUrl = "psacar_carlist.php"; // Return to list
			}

			// Get action
			$psacar_car->CurrentAction = "I"; // Display form
			switch ($psacar_car->CurrentAction) {
				case "I": // Get a record to display
					if (!$this->LoadRow()) { // Load record based on key
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$sReturnUrl = "psacar_carlist.php"; // No matching record, return to list
					}
			}

			// Export data only
			if (in_array($psacar_car->Export, array("html","word","excel","xml","csv","email"))) {
				if ($psacar_car->Export == "email" && $psacar_car->ExportReturnUrl() == ew_CurrentPage()) // Default return page
					$psacar_car->setExportReturnUrl($psacar_car->ViewUrl()); // Add key
				$this->ExportData();
				if ($psacar_car->Export <> "email")
					$this->Page_Terminate(); // Terminate response
				exit();
			}
		} else {
			$sReturnUrl = "psacar_carlist.php"; // Not page request, return to list
		}
		if ($sReturnUrl <> "")
			$this->Page_Terminate($sReturnUrl);

		// Render row
		$psacar_car->RowType = EW_ROWTYPE_VIEW;
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $psacar_car;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$psacar_car->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$psacar_car->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $psacar_car->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$psacar_car->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$psacar_car->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$psacar_car->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $psacar_car;

		// Call Recordset Selecting event
		$psacar_car->Recordset_Selecting($psacar_car->CurrentFilter);

		// Load List page SQL
		$sSql = $psacar_car->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $offset, $rowcnt";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$psacar_car->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $psacar_car;
		$sFilter = $psacar_car->KeyFilter();

		// Call Row Selecting event
		$psacar_car->Row_Selecting($sFilter);

		// Load SQL based on filter
		$psacar_car->CurrentFilter = $sFilter;
		$sSql = $psacar_car->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$psacar_car->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $psacar_car;
		$psacar_car->id->setDbValue($rs->fields('id'));
		$psacar_car->dealer_id->setDbValue($rs->fields('dealer_id'));
		$psacar_car->series_id->setDbValue($rs->fields('series_id'));
		$psacar_car->external_color_id->setDbValue($rs->fields('external_color_id'));
		$psacar_car->type_id->setDbValue($rs->fields('type_id'));
		$psacar_car->category_id->setDbValue($rs->fields('category_id'));
		$psacar_car->description->setDbValue($rs->fields('description'));
		$psacar_car->price->setDbValue($rs->fields('price'));
		$psacar_car->quality->setDbValue($rs->fields('quality'));
		$psacar_car->post_by->setDbValue($rs->fields('post_by'));
		$psacar_car->post_date->setDbValue($rs->fields('post_date'));
		$psacar_car->expiration_date->setDbValue($rs->fields('expiration_date'));
		$psacar_car->number_votes->setDbValue($rs->fields('number_votes'));
		$psacar_car->total_points->setDbValue($rs->fields('total_points'));
		$psacar_car->dec_avg->setDbValue($rs->fields('dec_avg'));
		$psacar_car->whole_avg->setDbValue($rs->fields('whole_avg'));
		$psacar_car->internal_color_id->setDbValue($rs->fields('internal_color_id'));
		$psacar_car->transmission->setDbValue($rs->fields('transmission'));
		$psacar_car->legal->setDbValue($rs->fields('legal'));
		$psacar_car->import_tax->setDbValue($rs->fields('import_tax'));
		$psacar_car->drive_train->setDbValue($rs->fields('drive_train'));
		$psacar_car->door_count->setDbValue($rs->fields('door_count'));
		$psacar_car->fuel->setDbValue($rs->fields('fuel'));
		$psacar_car->vat->setDbValue($rs->fields('vat'));
		$psacar_car->destinations->setDbValue($rs->fields('destinations'));
		$psacar_car->rent_type->setDbValue($rs->fields('rent_type'));
		$psacar_car->vehicle_type_id->setDbValue($rs->fields('vehicle_type_id'));
		$psacar_car->is_driver->setDbValue($rs->fields('is_driver'));
		$psacar_car->image->Upload->DbValue = $rs->fields('image');
		$psacar_car->vehicle_id_number->setDbValue($rs->fields('vehicle_id_number'));
		$psacar_car->negotiate->setDbValue($rs->fields('negotiate'));
		$psacar_car->duration_type->setDbValue($rs->fields('duration_type'));
		$psacar_car->duration->setDbValue($rs->fields('duration'));
		$psacar_car->create_date->setDbValue($rs->fields('create_date'));
		$psacar_car->end_date->setDbValue($rs->fields('end_date'));
		$psacar_car->status->setDbValue($rs->fields('status'));
		$psacar_car->code->setDbValue($rs->fields('code'));
		$psacar_car->created_date->setDbValue($rs->fields('created_date'));
		$psacar_car->modified_date->setDbValue($rs->fields('modified_date'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $psacar_car;

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->ExportWordUrl = $this->PageUrl() . "export=word&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv&" . "id=" . urlencode($psacar_car->id->CurrentValue);
		$this->AddUrl = $psacar_car->AddUrl();
		$this->EditUrl = $psacar_car->EditUrl();
		$this->CopyUrl = $psacar_car->CopyUrl();
		$this->DeleteUrl = $psacar_car->DeleteUrl();
		$this->ListUrl = $psacar_car->ListUrl();

		// Call Row_Rendering event
		$psacar_car->Row_Rendering();

		// Common render codes for all row types
		// id

		$psacar_car->id->CellCssStyle = ""; $psacar_car->id->CellCssClass = "";
		$psacar_car->id->CellAttrs = array(); $psacar_car->id->ViewAttrs = array(); $psacar_car->id->EditAttrs = array();

		// dealer_id
		$psacar_car->dealer_id->CellCssStyle = ""; $psacar_car->dealer_id->CellCssClass = "";
		$psacar_car->dealer_id->CellAttrs = array(); $psacar_car->dealer_id->ViewAttrs = array(); $psacar_car->dealer_id->EditAttrs = array();

		// series_id
		$psacar_car->series_id->CellCssStyle = ""; $psacar_car->series_id->CellCssClass = "";
		$psacar_car->series_id->CellAttrs = array(); $psacar_car->series_id->ViewAttrs = array(); $psacar_car->series_id->EditAttrs = array();

		// external_color_id
		$psacar_car->external_color_id->CellCssStyle = ""; $psacar_car->external_color_id->CellCssClass = "";
		$psacar_car->external_color_id->CellAttrs = array(); $psacar_car->external_color_id->ViewAttrs = array(); $psacar_car->external_color_id->EditAttrs = array();

		// type_id
		$psacar_car->type_id->CellCssStyle = ""; $psacar_car->type_id->CellCssClass = "";
		$psacar_car->type_id->CellAttrs = array(); $psacar_car->type_id->ViewAttrs = array(); $psacar_car->type_id->EditAttrs = array();

		// category_id
		$psacar_car->category_id->CellCssStyle = ""; $psacar_car->category_id->CellCssClass = "";
		$psacar_car->category_id->CellAttrs = array(); $psacar_car->category_id->ViewAttrs = array(); $psacar_car->category_id->EditAttrs = array();

		// description
		$psacar_car->description->CellCssStyle = ""; $psacar_car->description->CellCssClass = "";
		$psacar_car->description->CellAttrs = array(); $psacar_car->description->ViewAttrs = array(); $psacar_car->description->EditAttrs = array();

		// price
		$psacar_car->price->CellCssStyle = ""; $psacar_car->price->CellCssClass = "";
		$psacar_car->price->CellAttrs = array(); $psacar_car->price->ViewAttrs = array(); $psacar_car->price->EditAttrs = array();

		// quality
		$psacar_car->quality->CellCssStyle = ""; $psacar_car->quality->CellCssClass = "";
		$psacar_car->quality->CellAttrs = array(); $psacar_car->quality->ViewAttrs = array(); $psacar_car->quality->EditAttrs = array();

		// post_by
		$psacar_car->post_by->CellCssStyle = ""; $psacar_car->post_by->CellCssClass = "";
		$psacar_car->post_by->CellAttrs = array(); $psacar_car->post_by->ViewAttrs = array(); $psacar_car->post_by->EditAttrs = array();

		// post_date
		$psacar_car->post_date->CellCssStyle = ""; $psacar_car->post_date->CellCssClass = "";
		$psacar_car->post_date->CellAttrs = array(); $psacar_car->post_date->ViewAttrs = array(); $psacar_car->post_date->EditAttrs = array();

		// expiration_date
		$psacar_car->expiration_date->CellCssStyle = ""; $psacar_car->expiration_date->CellCssClass = "";
		$psacar_car->expiration_date->CellAttrs = array(); $psacar_car->expiration_date->ViewAttrs = array(); $psacar_car->expiration_date->EditAttrs = array();

		// number_votes
		$psacar_car->number_votes->CellCssStyle = ""; $psacar_car->number_votes->CellCssClass = "";
		$psacar_car->number_votes->CellAttrs = array(); $psacar_car->number_votes->ViewAttrs = array(); $psacar_car->number_votes->EditAttrs = array();

		// total_points
		$psacar_car->total_points->CellCssStyle = ""; $psacar_car->total_points->CellCssClass = "";
		$psacar_car->total_points->CellAttrs = array(); $psacar_car->total_points->ViewAttrs = array(); $psacar_car->total_points->EditAttrs = array();

		// dec_avg
		$psacar_car->dec_avg->CellCssStyle = ""; $psacar_car->dec_avg->CellCssClass = "";
		$psacar_car->dec_avg->CellAttrs = array(); $psacar_car->dec_avg->ViewAttrs = array(); $psacar_car->dec_avg->EditAttrs = array();

		// whole_avg
		$psacar_car->whole_avg->CellCssStyle = ""; $psacar_car->whole_avg->CellCssClass = "";
		$psacar_car->whole_avg->CellAttrs = array(); $psacar_car->whole_avg->ViewAttrs = array(); $psacar_car->whole_avg->EditAttrs = array();

		// internal_color_id
		$psacar_car->internal_color_id->CellCssStyle = ""; $psacar_car->internal_color_id->CellCssClass = "";
		$psacar_car->internal_color_id->CellAttrs = array(); $psacar_car->internal_color_id->ViewAttrs = array(); $psacar_car->internal_color_id->EditAttrs = array();

		// transmission
		$psacar_car->transmission->CellCssStyle = ""; $psacar_car->transmission->CellCssClass = "";
		$psacar_car->transmission->CellAttrs = array(); $psacar_car->transmission->ViewAttrs = array(); $psacar_car->transmission->EditAttrs = array();

		// legal
		$psacar_car->legal->CellCssStyle = ""; $psacar_car->legal->CellCssClass = "";
		$psacar_car->legal->CellAttrs = array(); $psacar_car->legal->ViewAttrs = array(); $psacar_car->legal->EditAttrs = array();

		// import_tax
		$psacar_car->import_tax->CellCssStyle = ""; $psacar_car->import_tax->CellCssClass = "";
		$psacar_car->import_tax->CellAttrs = array(); $psacar_car->import_tax->ViewAttrs = array(); $psacar_car->import_tax->EditAttrs = array();

		// drive_train
		$psacar_car->drive_train->CellCssStyle = ""; $psacar_car->drive_train->CellCssClass = "";
		$psacar_car->drive_train->CellAttrs = array(); $psacar_car->drive_train->ViewAttrs = array(); $psacar_car->drive_train->EditAttrs = array();

		// door_count
		$psacar_car->door_count->CellCssStyle = ""; $psacar_car->door_count->CellCssClass = "";
		$psacar_car->door_count->CellAttrs = array(); $psacar_car->door_count->ViewAttrs = array(); $psacar_car->door_count->EditAttrs = array();

		// fuel
		$psacar_car->fuel->CellCssStyle = ""; $psacar_car->fuel->CellCssClass = "";
		$psacar_car->fuel->CellAttrs = array(); $psacar_car->fuel->ViewAttrs = array(); $psacar_car->fuel->EditAttrs = array();

		// vat
		$psacar_car->vat->CellCssStyle = ""; $psacar_car->vat->CellCssClass = "";
		$psacar_car->vat->CellAttrs = array(); $psacar_car->vat->ViewAttrs = array(); $psacar_car->vat->EditAttrs = array();

		// destinations
		$psacar_car->destinations->CellCssStyle = ""; $psacar_car->destinations->CellCssClass = "";
		$psacar_car->destinations->CellAttrs = array(); $psacar_car->destinations->ViewAttrs = array(); $psacar_car->destinations->EditAttrs = array();

		// rent_type
		$psacar_car->rent_type->CellCssStyle = ""; $psacar_car->rent_type->CellCssClass = "";
		$psacar_car->rent_type->CellAttrs = array(); $psacar_car->rent_type->ViewAttrs = array(); $psacar_car->rent_type->EditAttrs = array();

		// vehicle_type_id
		$psacar_car->vehicle_type_id->CellCssStyle = ""; $psacar_car->vehicle_type_id->CellCssClass = "";
		$psacar_car->vehicle_type_id->CellAttrs = array(); $psacar_car->vehicle_type_id->ViewAttrs = array(); $psacar_car->vehicle_type_id->EditAttrs = array();

		// is_driver
		$psacar_car->is_driver->CellCssStyle = ""; $psacar_car->is_driver->CellCssClass = "";
		$psacar_car->is_driver->CellAttrs = array(); $psacar_car->is_driver->ViewAttrs = array(); $psacar_car->is_driver->EditAttrs = array();

		// image
		$psacar_car->image->CellCssStyle = ""; $psacar_car->image->CellCssClass = "";
		$psacar_car->image->CellAttrs = array(); $psacar_car->image->ViewAttrs = array(); $psacar_car->image->EditAttrs = array();

		// vehicle_id_number
		$psacar_car->vehicle_id_number->CellCssStyle = ""; $psacar_car->vehicle_id_number->CellCssClass = "";
		$psacar_car->vehicle_id_number->CellAttrs = array(); $psacar_car->vehicle_id_number->ViewAttrs = array(); $psacar_car->vehicle_id_number->EditAttrs = array();

		// negotiate
		$psacar_car->negotiate->CellCssStyle = ""; $psacar_car->negotiate->CellCssClass = "";
		$psacar_car->negotiate->CellAttrs = array(); $psacar_car->negotiate->ViewAttrs = array(); $psacar_car->negotiate->EditAttrs = array();

		// duration
		$psacar_car->duration->CellCssStyle = ""; $psacar_car->duration->CellCssClass = "";
		$psacar_car->duration->CellAttrs = array(); $psacar_car->duration->ViewAttrs = array(); $psacar_car->duration->EditAttrs = array();

		// create_date
		$psacar_car->create_date->CellCssStyle = ""; $psacar_car->create_date->CellCssClass = "";
		$psacar_car->create_date->CellAttrs = array(); $psacar_car->create_date->ViewAttrs = array(); $psacar_car->create_date->EditAttrs = array();

		// end_date
		$psacar_car->end_date->CellCssStyle = ""; $psacar_car->end_date->CellCssClass = "";
		$psacar_car->end_date->CellAttrs = array(); $psacar_car->end_date->ViewAttrs = array(); $psacar_car->end_date->EditAttrs = array();

		// status
		$psacar_car->status->CellCssStyle = ""; $psacar_car->status->CellCssClass = "";
		$psacar_car->status->CellAttrs = array(); $psacar_car->status->ViewAttrs = array(); $psacar_car->status->EditAttrs = array();

		// code
		$psacar_car->code->CellCssStyle = ""; $psacar_car->code->CellCssClass = "";
		$psacar_car->code->CellAttrs = array(); $psacar_car->code->ViewAttrs = array(); $psacar_car->code->EditAttrs = array();

		// created_date
		$psacar_car->created_date->CellCssStyle = ""; $psacar_car->created_date->CellCssClass = "";
		$psacar_car->created_date->CellAttrs = array(); $psacar_car->created_date->ViewAttrs = array(); $psacar_car->created_date->EditAttrs = array();

		// modified_date
		$psacar_car->modified_date->CellCssStyle = ""; $psacar_car->modified_date->CellCssClass = "";
		$psacar_car->modified_date->CellAttrs = array(); $psacar_car->modified_date->ViewAttrs = array(); $psacar_car->modified_date->EditAttrs = array();
		if ($psacar_car->RowType == EW_ROWTYPE_VIEW) { // View row

			// id
			$psacar_car->id->ViewValue = $psacar_car->id->CurrentValue;
			$psacar_car->id->CssStyle = "";
			$psacar_car->id->CssClass = "";
			$psacar_car->id->ViewCustomAttributes = "";

			// dealer_id
			if (strval($psacar_car->dealer_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($psacar_car->dealer_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `name` FROM `psacar_member`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->dealer_id->ViewValue = $rswrk->fields('name');
					$rswrk->Close();
				} else {
					$psacar_car->dealer_id->ViewValue = $psacar_car->dealer_id->CurrentValue;
				}
			} else {
				$psacar_car->dealer_id->ViewValue = NULL;
			}
			$psacar_car->dealer_id->CssStyle = "";
			$psacar_car->dealer_id->CssClass = "";
			$psacar_car->dealer_id->ViewCustomAttributes = "";

			// series_id
			if (strval($psacar_car->series_id->CurrentValue) <> "") {
				$sFilterWrk = "psacar_series.id = " . ew_AdjustSql($psacar_car->series_id->CurrentValue) . "";
			$sSqlWrk = "SELECT Concat(psacar_make.name, \" - \", psacar_model.name, \" - \", psacar_color.color) AS `make_model_color` FROM psacar_make INNER JOIN psacar_model ON psacar_make.id = psacar_model.make_id INNER JOIN psacar_series ON psacar_model.id = psacar_series.model_id INNER JOIN psacar_color ON psacar_color.id = psacar_series.color_id";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->series_id->ViewValue = $rswrk->fields('make_model_color');
					$rswrk->Close();
				} else {
					$psacar_car->series_id->ViewValue = $psacar_car->series_id->CurrentValue;
				}
			} else {
				$psacar_car->series_id->ViewValue = NULL;
			}
			$psacar_car->series_id->CssStyle = "";
			$psacar_car->series_id->CssClass = "";
			$psacar_car->series_id->ViewCustomAttributes = "";

			// external_color_id
			if (strval($psacar_car->external_color_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($psacar_car->external_color_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `color` FROM `psacar_color`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->external_color_id->ViewValue = $rswrk->fields('color');
					$rswrk->Close();
				} else {
					$psacar_car->external_color_id->ViewValue = $psacar_car->external_color_id->CurrentValue;
				}
			} else {
				$psacar_car->external_color_id->ViewValue = NULL;
			}
			$psacar_car->external_color_id->CssStyle = "";
			$psacar_car->external_color_id->CssClass = "";
			$psacar_car->external_color_id->ViewCustomAttributes = "";

			// type_id
			if (strval($psacar_car->type_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($psacar_car->type_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `name` FROM `psacar_car_type`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->type_id->ViewValue = $rswrk->fields('name');
					$rswrk->Close();
				} else {
					$psacar_car->type_id->ViewValue = $psacar_car->type_id->CurrentValue;
				}
			} else {
				$psacar_car->type_id->ViewValue = NULL;
			}
			$psacar_car->type_id->CssStyle = "";
			$psacar_car->type_id->CssClass = "";
			$psacar_car->type_id->ViewCustomAttributes = "";

			// category_id
			if (strval($psacar_car->category_id->CurrentValue) <> "") {
				$sFilterWrk = "`category_id` = " . ew_AdjustSql($psacar_car->category_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `category_name` FROM `psacar_category`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->category_id->ViewValue = $rswrk->fields('category_name');
					$rswrk->Close();
				} else {
					$psacar_car->category_id->ViewValue = $psacar_car->category_id->CurrentValue;
				}
			} else {
				$psacar_car->category_id->ViewValue = NULL;
			}
			$psacar_car->category_id->CssStyle = "";
			$psacar_car->category_id->CssClass = "";
			$psacar_car->category_id->ViewCustomAttributes = "";

			// description
			$psacar_car->description->ViewValue = $psacar_car->description->CurrentValue;
			$psacar_car->description->CssStyle = "";
			$psacar_car->description->CssClass = "";
			$psacar_car->description->ViewCustomAttributes = "";

			// price
			$psacar_car->price->ViewValue = $psacar_car->price->CurrentValue;
			$psacar_car->price->CssStyle = "";
			$psacar_car->price->CssClass = "";
			$psacar_car->price->ViewCustomAttributes = "";

			// quality
			$psacar_car->quality->ViewValue = $psacar_car->quality->CurrentValue;
			if (strval($psacar_car->quality->CurrentValue) <> "") {
				$sFilterWrk = "`code` = " . ew_AdjustSql($psacar_car->quality->CurrentValue) . "";
			$sSqlWrk = "SELECT `mileage` FROM `psacar_mileage`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->quality->ViewValue = $rswrk->fields('mileage');
					$rswrk->Close();
				} else {
					$psacar_car->quality->ViewValue = $psacar_car->quality->CurrentValue;
				}
			} else {
				$psacar_car->quality->ViewValue = NULL;
			}
			$psacar_car->quality->CssStyle = "";
			$psacar_car->quality->CssClass = "";
			$psacar_car->quality->ViewCustomAttributes = "";

			// post_by
			$psacar_car->post_by->ViewValue = $psacar_car->post_by->CurrentValue;
			$psacar_car->post_by->CssStyle = "";
			$psacar_car->post_by->CssClass = "";
			$psacar_car->post_by->ViewCustomAttributes = "";

			// post_date
			$psacar_car->post_date->ViewValue = $psacar_car->post_date->CurrentValue;
			$psacar_car->post_date->ViewValue = ew_FormatDateTime($psacar_car->post_date->ViewValue, 5);
			$psacar_car->post_date->CssStyle = "";
			$psacar_car->post_date->CssClass = "";
			$psacar_car->post_date->ViewCustomAttributes = "";

			// expiration_date
			$psacar_car->expiration_date->ViewValue = $psacar_car->expiration_date->CurrentValue;
			$psacar_car->expiration_date->ViewValue = ew_FormatDateTime($psacar_car->expiration_date->ViewValue, 5);
			$psacar_car->expiration_date->CssStyle = "";
			$psacar_car->expiration_date->CssClass = "";
			$psacar_car->expiration_date->ViewCustomAttributes = "";

			// number_votes
			$psacar_car->number_votes->ViewValue = $psacar_car->number_votes->CurrentValue;
			$psacar_car->number_votes->CssStyle = "";
			$psacar_car->number_votes->CssClass = "";
			$psacar_car->number_votes->ViewCustomAttributes = "";

			// total_points
			$psacar_car->total_points->ViewValue = $psacar_car->total_points->CurrentValue;
			$psacar_car->total_points->CssStyle = "";
			$psacar_car->total_points->CssClass = "";
			$psacar_car->total_points->ViewCustomAttributes = "";

			// dec_avg
			$psacar_car->dec_avg->ViewValue = $psacar_car->dec_avg->CurrentValue;
			$psacar_car->dec_avg->CssStyle = "";
			$psacar_car->dec_avg->CssClass = "";
			$psacar_car->dec_avg->ViewCustomAttributes = "";

			// whole_avg
			$psacar_car->whole_avg->ViewValue = $psacar_car->whole_avg->CurrentValue;
			$psacar_car->whole_avg->CssStyle = "";
			$psacar_car->whole_avg->CssClass = "";
			$psacar_car->whole_avg->ViewCustomAttributes = "";

			// internal_color_id
			if (strval($psacar_car->internal_color_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($psacar_car->internal_color_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `color` FROM `psacar_color`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->internal_color_id->ViewValue = $rswrk->fields('color');
					$rswrk->Close();
				} else {
					$psacar_car->internal_color_id->ViewValue = $psacar_car->internal_color_id->CurrentValue;
				}
			} else {
				$psacar_car->internal_color_id->ViewValue = NULL;
			}
			$psacar_car->internal_color_id->CssStyle = "";
			$psacar_car->internal_color_id->CssClass = "";
			$psacar_car->internal_color_id->ViewCustomAttributes = "";

			// transmission
			if (strval($psacar_car->transmission->CurrentValue) <> "") {
				switch ($psacar_car->transmission->CurrentValue) {
					case "0":
						$psacar_car->transmission->ViewValue = "Manual";
						break;
					case "1":
						$psacar_car->transmission->ViewValue = "Automatic";
						break;
					case "2":
						$psacar_car->transmission->ViewValue = "Auto/manual";
						break;
					case "3":
						$psacar_car->transmission->ViewValue = "Others";
						break;
					default:
						$psacar_car->transmission->ViewValue = $psacar_car->transmission->CurrentValue;
				}
			} else {
				$psacar_car->transmission->ViewValue = NULL;
			}
			$psacar_car->transmission->CssStyle = "";
			$psacar_car->transmission->CssClass = "";
			$psacar_car->transmission->ViewCustomAttributes = "";

			// legal
			if (strval($psacar_car->legal->CurrentValue) <> "") {
				switch ($psacar_car->legal->CurrentValue) {
					case "0":
						$psacar_car->legal->ViewValue = "Owner transfer fee included";
						break;
					case "1":
						$psacar_car->legal->ViewValue = "Owner transfer fee not included";
						break;
					case "2":
						$psacar_car->legal->ViewValue = "Others";
						break;
					default:
						$psacar_car->legal->ViewValue = $psacar_car->legal->CurrentValue;
				}
			} else {
				$psacar_car->legal->ViewValue = NULL;
			}
			$psacar_car->legal->CssStyle = "";
			$psacar_car->legal->CssClass = "";
			$psacar_car->legal->ViewCustomAttributes = "";

			// import_tax
			if (strval($psacar_car->import_tax->CurrentValue) <> "") {
				switch ($psacar_car->import_tax->CurrentValue) {
					case "0":
						$psacar_car->import_tax->ViewValue = "Yes";
						break;
					case "1":
						$psacar_car->import_tax->ViewValue = "No";
						break;
					case "2":
						$psacar_car->import_tax->ViewValue = "Other";
						break;
					default:
						$psacar_car->import_tax->ViewValue = $psacar_car->import_tax->CurrentValue;
				}
			} else {
				$psacar_car->import_tax->ViewValue = NULL;
			}
			$psacar_car->import_tax->CssStyle = "";
			$psacar_car->import_tax->CssClass = "";
			$psacar_car->import_tax->ViewCustomAttributes = "";

			// drive_train
			if (strval($psacar_car->drive_train->CurrentValue) <> "") {
				switch ($psacar_car->drive_train->CurrentValue) {
					case "0":
						$psacar_car->drive_train->ViewValue = "2WD";
						break;
					case "1":
						$psacar_car->drive_train->ViewValue = "4WD";
						break;
					case "2":
						$psacar_car->drive_train->ViewValue = "FWD";
						break;
					case "3":
						$psacar_car->drive_train->ViewValue = "RWD";
						break;
					case "4":
						$psacar_car->drive_train->ViewValue = "Others";
						break;
					default:
						$psacar_car->drive_train->ViewValue = $psacar_car->drive_train->CurrentValue;
				}
			} else {
				$psacar_car->drive_train->ViewValue = NULL;
			}
			$psacar_car->drive_train->CssStyle = "";
			$psacar_car->drive_train->CssClass = "";
			$psacar_car->drive_train->ViewCustomAttributes = "";

			// door_count
			if (strval($psacar_car->door_count->CurrentValue) <> "") {
				$sFilterWrk = "`code` = " . ew_AdjustSql($psacar_car->door_count->CurrentValue) . "";
			$sSqlWrk = "SELECT `doorcount` FROM `psacar_doorcount`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->door_count->ViewValue = $rswrk->fields('doorcount');
					$rswrk->Close();
				} else {
					$psacar_car->door_count->ViewValue = $psacar_car->door_count->CurrentValue;
				}
			} else {
				$psacar_car->door_count->ViewValue = NULL;
			}
			$psacar_car->door_count->CssStyle = "";
			$psacar_car->door_count->CssClass = "";
			$psacar_car->door_count->ViewCustomAttributes = "";

			// fuel
			if (strval($psacar_car->fuel->CurrentValue) <> "") {
				$arwrk = explode(",", $psacar_car->fuel->CurrentValue);
				$sFilterWrk = "";
				foreach ($arwrk as $wrk) {
					if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
					$sFilterWrk .= "`id` = " . ew_AdjustSql(trim($wrk)) . "";
				}	
			$sSqlWrk = "SELECT `fuel` FROM `psacar_fuel`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$psacar_car->fuel->ViewValue = "";
					$ari = 0;
					while (!$rswrk->EOF) {
						$psacar_car->fuel->ViewValue .= $rswrk->fields('fuel');
						$rswrk->MoveNext();
						if (!$rswrk->EOF) $psacar_car->fuel->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options
						$ari++;
					}
					$rswrk->Close();
				} else {
					$psacar_car->fuel->ViewValue = $psacar_car->fuel->CurrentValue;
				}
			} else {
				$psacar_car->fuel->ViewValue = NULL;
			}
			$psacar_car->fuel->CssStyle = "";
			$psacar_car->fuel->CssClass = "";
			$psacar_car->fuel->ViewCustomAttributes = "";

			// vat
			if (strval($psacar_car->vat->CurrentValue) <> "") {
				switch ($psacar_car->vat->CurrentValue) {
					case "0":
						$psacar_car->vat->ViewValue = "Included";
						break;
					case "1":
						$psacar_car->vat->ViewValue = "Not included";
						break;
					default:
						$psacar_car->vat->ViewValue = $psacar_car->vat->CurrentValue;
				}
			} else {
				$psacar_car->vat->ViewValue = NULL;
			}
			$psacar_car->vat->CssStyle = "";
			$psacar_car->vat->CssClass = "";
			$psacar_car->vat->ViewCustomAttributes = "";

			// destinations
			if (strval($psacar_car->destinations->CurrentValue) <> "") {
				switch ($psacar_car->destinations->CurrentValue) {
					case "0":
						$psacar_car->destinations->ViewValue = "Airport Pickup";
						break;
					case "1":
						$psacar_car->destinations->ViewValue = "Airport Drop off";
						break;
					case "2":
						$psacar_car->destinations->ViewValue = "Hourly";
						break;
					case "3":
						$psacar_car->destinations->ViewValue = "Hafday";
						break;
					case "4":
						$psacar_car->destinations->ViewValue = "Full day";
						break;
					case "5":
						$psacar_car->destinations->ViewValue = "Tour Package";
						break;
					case "":
						$psacar_car->destinations->ViewValue = "";
						break;
					default:
						$psacar_car->destinations->ViewValue = $psacar_car->destinations->CurrentValue;
				}
			} else {
				$psacar_car->destinations->ViewValue = NULL;
			}
			$psacar_car->destinations->CssStyle = "";
			$psacar_car->destinations->CssClass = "";
			$psacar_car->destinations->ViewCustomAttributes = "";

			// rent_type
			if (strval($psacar_car->rent_type->CurrentValue) <> "") {
				switch ($psacar_car->rent_type->CurrentValue) {
					case "0":
						$psacar_car->rent_type->ViewValue = "Long term leasing";
						break;
					case "1":
						$psacar_car->rent_type->ViewValue = "Short term leasing";
						break;
					case "2":
						$psacar_car->rent_type->ViewValue = "Tour Package";
						break;
					default:
						$psacar_car->rent_type->ViewValue = $psacar_car->rent_type->CurrentValue;
				}
			} else {
				$psacar_car->rent_type->ViewValue = NULL;
			}
			$psacar_car->rent_type->CssStyle = "";
			$psacar_car->rent_type->CssClass = "";
			$psacar_car->rent_type->ViewCustomAttributes = "";

			// vehicle_type_id
			if (strval($psacar_car->vehicle_type_id->CurrentValue) <> "") {
				switch ($psacar_car->vehicle_type_id->CurrentValue) {
					case "0":
						$psacar_car->vehicle_type_id->ViewValue = "Buy";
						break;
					case "1":
						$psacar_car->vehicle_type_id->ViewValue = "Sale";
						break;
					case "2":
						$psacar_car->vehicle_type_id->ViewValue = "Rent";
						break;
					default:
						$psacar_car->vehicle_type_id->ViewValue = $psacar_car->vehicle_type_id->CurrentValue;
				}
			} else {
				$psacar_car->vehicle_type_id->ViewValue = NULL;
			}
			$psacar_car->vehicle_type_id->CssStyle = "";
			$psacar_car->vehicle_type_id->CssClass = "";
			$psacar_car->vehicle_type_id->ViewCustomAttributes = "";

			// is_driver
			if (strval($psacar_car->is_driver->CurrentValue) <> "") {
				switch ($psacar_car->is_driver->CurrentValue) {
					case "0":
						$psacar_car->is_driver->ViewValue = "With Driver";
						break;
					case "1":
						$psacar_car->is_driver->ViewValue = "Without Driver";
						break;
					default:
						$psacar_car->is_driver->ViewValue = $psacar_car->is_driver->CurrentValue;
				}
			} else {
				$psacar_car->is_driver->ViewValue = NULL;
			}
			$psacar_car->is_driver->CssStyle = "";
			$psacar_car->is_driver->CssClass = "";
			$psacar_car->is_driver->ViewCustomAttributes = "";

			// image
			if (!ew_Empty($psacar_car->image->Upload->DbValue)) {
				$psacar_car->image->ViewValue = $psacar_car->image->Upload->DbValue;
			} else {
				$psacar_car->image->ViewValue = "";
			}
			$psacar_car->image->CssStyle = "";
			$psacar_car->image->CssClass = "";
			$psacar_car->image->ViewCustomAttributes = "";

			// vehicle_id_number
			$psacar_car->vehicle_id_number->ViewValue = $psacar_car->vehicle_id_number->CurrentValue;
			$psacar_car->vehicle_id_number->CssStyle = "";
			$psacar_car->vehicle_id_number->CssClass = "";
			$psacar_car->vehicle_id_number->ViewCustomAttributes = "";

			// negotiate
			if (strval($psacar_car->negotiate->CurrentValue) <> "") {
				$psacar_car->negotiate->ViewValue = "";
				$arwrk = explode(",", strval($psacar_car->negotiate->CurrentValue));
				for ($ari = 0; $ari < count($arwrk); $ari++) {
					switch (trim($arwrk[$ari])) {
						case "1":
							$psacar_car->negotiate->ViewValue .= "Yes/No";
							break;
						default:
							$psacar_car->negotiate->ViewValue .= trim($arwrk[$ari]);
					}
					if ($ari < count($arwrk)-1) $psacar_car->negotiate->ViewValue .= ew_ViewOptionSeparator($ari);
				}
			} else {
				$psacar_car->negotiate->ViewValue = NULL;
			}
			$psacar_car->negotiate->CssStyle = "";
			$psacar_car->negotiate->CssClass = "";
			$psacar_car->negotiate->ViewCustomAttributes = "";

			// duration
			$psacar_car->duration->ViewValue = $psacar_car->duration->CurrentValue;
			$psacar_car->duration->CssStyle = "";
			$psacar_car->duration->CssClass = "";
			$psacar_car->duration->ViewCustomAttributes = "";

			// create_date
			$psacar_car->create_date->ViewValue = $psacar_car->create_date->CurrentValue;
			$psacar_car->create_date->ViewValue = ew_FormatDateTime($psacar_car->create_date->ViewValue, 5);
			$psacar_car->create_date->CssStyle = "";
			$psacar_car->create_date->CssClass = "";
			$psacar_car->create_date->ViewCustomAttributes = "";

			// end_date
			$psacar_car->end_date->ViewValue = $psacar_car->end_date->CurrentValue;
			$psacar_car->end_date->ViewValue = ew_FormatDateTime($psacar_car->end_date->ViewValue, 5);
			$psacar_car->end_date->CssStyle = "";
			$psacar_car->end_date->CssClass = "";
			$psacar_car->end_date->ViewCustomAttributes = "";

			// status
			if (strval($psacar_car->status->CurrentValue) <> "") {
				switch ($psacar_car->status->CurrentValue) {
					case "0":
						$psacar_car->status->ViewValue = "Pendding";
						break;
					case "1":
						$psacar_car->status->ViewValue = "Approved";
						break;
					case "2":
						$psacar_car->status->ViewValue = "Deleted";
						break;
					default:
						$psacar_car->status->ViewValue = $psacar_car->status->CurrentValue;
				}
			} else {
				$psacar_car->status->ViewValue = NULL;
			}
			$psacar_car->status->CssStyle = "";
			$psacar_car->status->CssClass = "";
			$psacar_car->status->ViewCustomAttributes = "";

			// code
			$psacar_car->code->ViewValue = $psacar_car->code->CurrentValue;
			$psacar_car->code->CssStyle = "";
			$psacar_car->code->CssClass = "";
			$psacar_car->code->ViewCustomAttributes = "";

			// created_date
			$psacar_car->created_date->ViewValue = $psacar_car->created_date->CurrentValue;
			$psacar_car->created_date->ViewValue = ew_FormatDateTime($psacar_car->created_date->ViewValue, 5);
			$psacar_car->created_date->CssStyle = "";
			$psacar_car->created_date->CssClass = "";
			$psacar_car->created_date->ViewCustomAttributes = "";

			// modified_date
			$psacar_car->modified_date->ViewValue = $psacar_car->modified_date->CurrentValue;
			$psacar_car->modified_date->ViewValue = ew_FormatDateTime($psacar_car->modified_date->ViewValue, 5);
			$psacar_car->modified_date->CssStyle = "";
			$psacar_car->modified_date->CssClass = "";
			$psacar_car->modified_date->ViewCustomAttributes = "";

			// id
			$psacar_car->id->HrefValue = "";
			$psacar_car->id->TooltipValue = "";

			// dealer_id
			$psacar_car->dealer_id->HrefValue = "";
			$psacar_car->dealer_id->TooltipValue = "";

			// series_id
			$psacar_car->series_id->HrefValue = "";
			$psacar_car->series_id->TooltipValue = "";

			// external_color_id
			$psacar_car->external_color_id->HrefValue = "";
			$psacar_car->external_color_id->TooltipValue = "";

			// type_id
			$psacar_car->type_id->HrefValue = "";
			$psacar_car->type_id->TooltipValue = "";

			// category_id
			$psacar_car->category_id->HrefValue = "";
			$psacar_car->category_id->TooltipValue = "";

			// description
			$psacar_car->description->HrefValue = "";
			$psacar_car->description->TooltipValue = "";

			// price
			$psacar_car->price->HrefValue = "";
			$psacar_car->price->TooltipValue = "";

			// quality
			$psacar_car->quality->HrefValue = "";
			$psacar_car->quality->TooltipValue = "";

			// post_by
			$psacar_car->post_by->HrefValue = "";
			$psacar_car->post_by->TooltipValue = "";

			// post_date
			$psacar_car->post_date->HrefValue = "";
			$psacar_car->post_date->TooltipValue = "";

			// expiration_date
			$psacar_car->expiration_date->HrefValue = "";
			$psacar_car->expiration_date->TooltipValue = "";

			// number_votes
			$psacar_car->number_votes->HrefValue = "";
			$psacar_car->number_votes->TooltipValue = "";

			// total_points
			$psacar_car->total_points->HrefValue = "";
			$psacar_car->total_points->TooltipValue = "";

			// dec_avg
			$psacar_car->dec_avg->HrefValue = "";
			$psacar_car->dec_avg->TooltipValue = "";

			// whole_avg
			$psacar_car->whole_avg->HrefValue = "";
			$psacar_car->whole_avg->TooltipValue = "";

			// internal_color_id
			$psacar_car->internal_color_id->HrefValue = "";
			$psacar_car->internal_color_id->TooltipValue = "";

			// transmission
			$psacar_car->transmission->HrefValue = "";
			$psacar_car->transmission->TooltipValue = "";

			// legal
			$psacar_car->legal->HrefValue = "";
			$psacar_car->legal->TooltipValue = "";

			// import_tax
			$psacar_car->import_tax->HrefValue = "";
			$psacar_car->import_tax->TooltipValue = "";

			// drive_train
			$psacar_car->drive_train->HrefValue = "";
			$psacar_car->drive_train->TooltipValue = "";

			// door_count
			$psacar_car->door_count->HrefValue = "";
			$psacar_car->door_count->TooltipValue = "";

			// fuel
			$psacar_car->fuel->HrefValue = "";
			$psacar_car->fuel->TooltipValue = "";

			// vat
			$psacar_car->vat->HrefValue = "";
			$psacar_car->vat->TooltipValue = "";

			// destinations
			$psacar_car->destinations->HrefValue = "";
			$psacar_car->destinations->TooltipValue = "";

			// rent_type
			$psacar_car->rent_type->HrefValue = "";
			$psacar_car->rent_type->TooltipValue = "";

			// vehicle_type_id
			$psacar_car->vehicle_type_id->HrefValue = "";
			$psacar_car->vehicle_type_id->TooltipValue = "";

			// is_driver
			$psacar_car->is_driver->HrefValue = "";
			$psacar_car->is_driver->TooltipValue = "";

			// image
			if (!ew_Empty($psacar_car->image->Upload->DbValue)) {
				$psacar_car->image->HrefValue = ew_UploadPathEx(FALSE, $psacar_car->image->UploadPath) . ((!empty($psacar_car->image->ViewValue)) ? $psacar_car->image->ViewValue : $psacar_car->image->CurrentValue);
				if ($psacar_car->Export <> "") $psacar_car->image->HrefValue = ew_ConvertFullUrl($psacar_car->image->HrefValue);
			} else {
				$psacar_car->image->HrefValue = "";
			}
			$psacar_car->image->TooltipValue = "";

			// vehicle_id_number
			$psacar_car->vehicle_id_number->HrefValue = "";
			$psacar_car->vehicle_id_number->TooltipValue = "";

			// negotiate
			$psacar_car->negotiate->HrefValue = "";
			$psacar_car->negotiate->TooltipValue = "";

			// duration
			$psacar_car->duration->HrefValue = "";
			$psacar_car->duration->TooltipValue = "";

			// create_date
			$psacar_car->create_date->HrefValue = "";
			$psacar_car->create_date->TooltipValue = "";

			// end_date
			$psacar_car->end_date->HrefValue = "";
			$psacar_car->end_date->TooltipValue = "";

			// status
			$psacar_car->status->HrefValue = "";
			$psacar_car->status->TooltipValue = "";

			// code
			$psacar_car->code->HrefValue = "";
			$psacar_car->code->TooltipValue = "";

			// created_date
			$psacar_car->created_date->HrefValue = "";
			$psacar_car->created_date->TooltipValue = "";

			// modified_date
			$psacar_car->modified_date->HrefValue = "";
			$psacar_car->modified_date->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($psacar_car->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$psacar_car->Row_Rendered();
	}

	// Export data in HTML/CSV/Word/Excel/XML/Email format
	function ExportData() {
		global $psacar_car;
		$utf8 = TRUE;
		$bSelectLimit = FALSE;

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $psacar_car->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;
		$this->SetUpStartRec(); // Set up start record position

		// Set the last record to display
		if ($this->lDisplayRecs < 0) {
			$this->lStopRec = $this->lTotalRecs;
		} else {
			$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
		}
		if (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($psacar_car->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($psacar_car, "v");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($psacar_car->series_id);
				$ExportDoc->ExportCaption($psacar_car->quality);
				$ExportDoc->ExportCaption($psacar_car->fuel);
				$ExportDoc->ExportCaption($psacar_car->vehicle_type_id);
				$ExportDoc->ExportCaption($psacar_car->create_date);
				$ExportDoc->ExportCaption($psacar_car->end_date);
				$ExportDoc->ExportCaption($psacar_car->status);
				$ExportDoc->ExportCaption($psacar_car->code);
				$ExportDoc->EndExportRow();
			}
		}

		// Move to first record
		$this->lRecCnt = $this->lStartRec - 1;
		if (!$rs->EOF) {
			$rs->MoveFirst();
			if (!$bSelectLimit && $this->lStartRec > 1)
				$rs->Move($this->lStartRec - 1);
		}
		while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
			$this->lRecCnt++;
			if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
				$this->LoadRowValues($rs);

				// Render row
				$psacar_car->CssClass = "";
				$psacar_car->CssStyle = "";
				$psacar_car->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($psacar_car->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('series_id', $psacar_car->series_id->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('quality', $psacar_car->quality->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('fuel', $psacar_car->fuel->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('vehicle_type_id', $psacar_car->vehicle_type_id->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('create_date', $psacar_car->create_date->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('end_date', $psacar_car->end_date->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('status', $psacar_car->status->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
					$XmlDoc->AddField('code', $psacar_car->code->ExportValue($psacar_car->Export, $psacar_car->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($psacar_car->series_id);
					$ExportDoc->ExportField($psacar_car->quality);
					$ExportDoc->ExportField($psacar_car->fuel);
					$ExportDoc->ExportField($psacar_car->vehicle_type_id);
					$ExportDoc->ExportField($psacar_car->create_date);
					$ExportDoc->ExportField($psacar_car->end_date);
					$ExportDoc->ExportField($psacar_car->status);
					$ExportDoc->ExportField($psacar_car->code);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($psacar_car->Export <> "xml")
			$ExportDoc->ExportFooter();

		// Close recordset
		$rs->Close();

		// Clean output buffer
		if (!EW_DEBUG_ENABLED && ob_get_length())
			ob_end_clean();

		// Write BOM if utf-8
		if ($utf8 && !in_array($psacar_car->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

		// Write debug message if enabled
		if (EW_DEBUG_ENABLED)
			echo ew_DebugMsg();

		// Output data
		if ($psacar_car->Export == "xml") {
			header("Content-Type: text/xml");
			echo $XmlDoc->XML();
		} elseif ($psacar_car->Export == "email") {
			$this->ExportEmail($ExportDoc->Text);
			$this->Page_Terminate($psacar_car->ExportReturnUrl());
		} else {
			echo $ExportDoc->Text;
		}
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}
}
?>
